package day18;

import java.io.FileReader;
import java.io.IOException;

public class FileReaderDemo {

	public static void main(String[] args) {
		FileReader fr = null;
		try {
			fr = new FileReader("demo.txt");
			/*
			 * int read; while ((read=fr.read()) != -1) {
			 * System.out.println("read->"+((char)read)); }
			 */
			char[] chs = new char[1024];
			int len = 0;
			while ((len = fr.read(chs)) != -1) {
				System.out.println(new String(chs, 0, len));
			}
		} catch (IOException e) {
			e.printStackTrace();
		} finally {
			if (null != null) {
				try {
					fr.close();
				} catch (Exception ex) {
					ex.printStackTrace();
				}
			}
		}
	}
}
